-
Notifications
You must be signed in to change notification settings - Fork 26
add lazy_imread function that accepts list of images
#152
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add lazy_imread function that accepts list of images
#152
Conversation
This commit changes image reading to be more flexible: input can be a single path, a glob pattern or a list of image paths. Images of different sizes are stacked using dask delayed arrays. (Mostly inspired by napari's own default implementation.) Previous implementation only allowed for a glob pattern when loading multiple images. This has the disadvantage that files with different extensions cannot be loaded. Fixes issue #3160 with multiple images that have different extensions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR enhances image loading flexibility by introducing a new lazy_imread function that accepts various input formats (single path, glob pattern, or list of image paths) and supports both dask and numpy arrays. The change addresses the limitation where only the first file's extension was used to create a glob pattern, preventing loading of image folders with mixed file extensions.
Changes:
- Added
_filter_extensionshelper function to validate image paths by their extensions - Replaced folder parsing logic to collect all valid image files instead of creating a glob pattern from the first file
- Introduced
lazy_imreadfunction with support for dask delayed arrays and flexible input formats
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
@deruyter92 Sorry just asked Copilot out of curiosity, will work on this tomorrow! |
|
@deruyter92 Due to some permissions issues across forks I had to reopen elsewhere after rebasing on #153; the updated+rebased version can be found here. |
|
Update : opened #154 as replacement PR, sorry @deruyter92 everything I tried to push on your fork directly after rebasing failed so far; hopefully we can help avoid this in the future by not using forks, since we now have write access. There's probably a way to do it but to save time I'll use the new PR. |
|
Perfect! No problem |
Problem description:
When loading an image folder, previous implementation only looked at the first file to create a glob pattern for loading all images in the folder. This has the disadvantage that files with different extensions cannot be loaded. See issue #3160 on the DeepLabCut repository.
Changes:
This commit changes image reading to be more flexible: input can be a single path, a glob pattern or a list of image paths. Images of different sizes are stacked using dask delayed arrays. (Mostly inspired by napari's own default implementation.)
When loading an image folder, all files with valid image extensions are selected inside that folder.